<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}项目合作归属数据管理系统{% endblock %}</title>
    
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="{{ url_for('static', filename='css/base.css') }}" rel="stylesheet">
    
    {% block extra_css %}{% endblock %}
</head>
<body>
    {% if current_user.is_authenticated %}
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container-fluid">
            <a class="navbar-brand" href="{{ url_for('main.dashboard') }}">
                <i class="bi bi-building"></i> 项目合作管理系统
            </a>
            
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('main.dashboard') }}">
                            <i class="bi bi-house"></i> 主页
                        </a>
                    </li>
                    
                    <!-- 组织管理 -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="orgManagement" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-people"></i> 组织管理
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{{ url_for('customer.customer_management') }}">客户管理</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('staff.staff_management') }}">人员管理</a></li>
                        </ul>
                    </li>
                    
                    <!-- 合作商谈管理 -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="negManagement" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-chat-dots"></i> 合作商谈管理
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{{ url_for('negotiation.negotiation_list') }}">合作商谈列表</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('negotiation.upload_exceptions') }}">上传异常数据</a></li>
                        </ul>
                    </li>
                    
                    <!-- 统计数据 -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="statistics" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-graph-up"></i> 统计数据
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{{ url_for('statistics.stats_by_staff') }}">按项目负责人统计</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('statistics.stats_by_customer') }}">按客户统计</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('statistics.stats_by_position') }}">按职务统计</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('statistics.weekly_ongoing') }}">每周合作客户商谈时间</a></li>
                            <li><a class="dropdown-item" href="{{ url_for('statistics.weekly_minmax') }}">每周客户最长最短商谈记录</a></li>
                        </ul>
                    </li>
                    
                    <!-- 报表生成 -->
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('reports.report_generation') }}">
                            <i class="bi bi-file-earmark-text"></i> 报表生成
                        </a>
                    </li>
                    
                    <!-- 考勤管理 -->
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('attendance.attendance_management') }}">
                            <i class="bi bi-clock"></i> 考勤管理
                        </a>
                    </li>
                </ul>
                
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userMenu" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle"></i> {{ current_user.username }}
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="{{ url_for('auth.logout') }}">退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    {% endif %}
    
    <!-- 主要内容区域 -->
    <main class="container-fluid py-4">
        <!-- Flash 消息 -->
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                <div class="row">
                    <div class="col-12">
                        {% for message in messages %}
                            <div class="alert alert-info alert-dismissible fade show" role="alert">
                                {{ message }}
                                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </main>
    
    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <!-- Custom JS -->
    <script src="{{ url_for('static', filename='js/base.js') }}"></script>
    
    {% block extra_js %}{% endblock %}
</body>
</html>
